import { CopyControllerBase } from "./CopyControllerBase";
import { SGuildGroup } from "../../../../../Message/Public/SGuildGroup";
import { ClockManager } from "../../../manager/ClockManager";
import { TCopy } from "../../../../../Message/Db/Tables/TCopy";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { EventName } from "../../../mvc/EventName";
import { DataEvent } from "../../../events/DataEvent";
import { GuildEliteModule } from "../guildElite/GuildEliteModule";
import { BaseHintIcon } from "../../common/hintIcon/BaseHintIcon";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GuildEliteCopyInfoPanel } from "../guildElite/GuildEliteCopyInfoPanel";
import { GuildEliteGroupModule } from "../guildElite/group/GuildEliteGroupModule";
import { GModuleEvent } from "../../../mvc/GModuleEvent";
import { GuildEliteGroupPanel } from "../guildElite/group/GuildEliteGroupPanel";
import { NetDispatcher } from "../../../../mvc/core/NetDispatcher";
import { EPublicCommand } from "../../../../../Message/Command/EPublicCommand";
import { ServerCommand } from "../../../mvc/ServerCommand";
import { Alert } from "../../../../../com/mui/controls/Alert";
import { Language } from "../../../../../extend/language/Language";
import { MsgManager } from "../../../manager/MsgManager";
import { GameProxy } from "../../../mvc/GameProxy";
import { EliteTowerFloorData } from "../guildElite/EliteTowerFloorData";
import { ECopyType } from "../../../../../Message/Public/ECopyType";
import { SPassPoint } from "../../../../../Message/Public/SPassPoint";
import { SPassTo } from "../../../../../Message/Public/SPassTo";
import { EPassType } from "../../../../../Message/Game/EPassType";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { SGuildEliteCopyInfo } from "../../../../../Message/Public/SGuildEliteCopyInfo";
import { GameMapUtil } from "../../../scene/map/GameMapUtil";
import { SGuildEliteCopyDetail } from "../../../../../Message/Public/SGuildEliteCopyDetail";
import { CopyConfig } from "../../../resource/CopyConfig";
import { GuildEliteConfig } from "../config/GuildEliteConfig";
import { EGuildGroupPos } from "../../../../../Message/Public/EGuildGroupPos";
import { SAttribute } from "../../../../../Message/Public/SAttribute";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
type int = number;
//class GuildEliteCopyController
    
    export  class GuildEliteCopyController extends CopyControllerBase
    {
        constructor()
        {
            super();
            return;
        }

        /* internal  */updateGuildGroupGroupPart(arg1: SGuildGroup): void
        {
            if (this._guildEliteGroupModule == null) 
            {
                return;
            }
            if (arg1 == null) 
            {
                this._guildEliteGroupModule.updateGroupCommander("");
                this._guildEliteGroupModule.updateGroupData(null, null);
                return;
            }
            this._guildEliteGroupModule.updateGroupCommander(cache.guildElite.getCommanderName(arg1));
            this._guildEliteGroupModule.updateGroupData(arg1, cache.guildElite.getGuildGroupMemberDp(arg1.copyCode));
            return;
        }

        /* internal  */updateGuildGroupButtonState(): void
        {
            var loc1=false;
            var loc2=0;
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                loc1 = cache.guildElite.inPreTime;
                if (loc1) 
                {
                    loc2 = (cache.guildElite.guildEliteCopyInfo.preOpenDt.time - ClockManager.instance.nowDate.time) / 1000;
                    this._guildEliteGroupModule.updateButtonState(true, loc2);
                }
                else 
                {
                    this._guildEliteGroupModule.updateButtonState(false, 0);
                    loc2 = (cache.guildElite.guildEliteCopyInfo.openDt.time + 30 * 60 * 1000 - ClockManager.instance.nowDate.time) / 1000;
                    this._guildEliteGroupModule.updateLeftTime(loc2);
                }
            }
            return;
        }

        /* internal  */updateCopyGroupPanelPlayers(arg1: SGuildGroup): void
        {
            if (arg1 && copy && !(copy.code == arg1.copyCode)) 
            {
                return;
            }
            if (this._guildEliteGroupPanel && !this._guildEliteGroupPanel.isHide && copy) 
            {
                this._guildEliteGroupPanel.updatePlayers(cache.guildElite.getGuildGroupMemberDp(copy.code));
            }
            return;
        }

        public /* override */ enterCopy(arg1: TCopy): void
        {
            super.enterCopy(arg1);
            if (this._guildEliteModule && !this._guildEliteModule.isHide) 
            {
                this._guildEliteModule.hide();
            }
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                this._guildEliteGroupModule.hide();
            }
            this.guildEliteCopyInfoPanel.show();
            this.guildEliteCopyInfoPanel.title = arg1.name;
            this.guildEliteCopyInfoPanel.updatePosition();
            this.guildEliteCopyInfoPanel.updateInfos(cache.guildElite.copyDetail);
            Dispatcher.addEventListener(EventName.Scene_Update, this.onSceneUpdateHandler);
            this.guildEliteGroupPanel.show(220, 165);
            this.guildEliteGroupPanel.updatePlayers(cache.guildElite.getGuildGroupMemberDp(arg1.code));
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyEnterCopyMap));
            return;
        }

        public /* override */ leaveCopy(): void
        {
            super.leaveCopy();
            if (this._guildEliteCopyInfoPanel) 
            {
                this._guildEliteCopyInfoPanel.hide();
                this._guildEliteCopyInfoPanel.dispose();
                this._guildEliteCopyInfoPanel = null;
            }
            if (this._guildEliteGroupPanel) 
            {
                this._guildEliteGroupPanel.hide();
                this._guildEliteGroupPanel.dispose();
                this._guildEliteGroupPanel = null;
            }
            Dispatcher.removeEventListener(EventName.Scene_Update, this.onSceneUpdateHandler);
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildElite_LeaveGuildEliteCopy));
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyLeaveCopyMap));
            return;
        }

        public get guildEliteModule(): GuildEliteModule
        {
            if (!this._guildEliteModule) 
            {
                this._guildEliteModule = new GuildEliteModule();
            }
            return this._guildEliteModule;
        }

        public get guildEliteIcon(): BaseHintIcon
        {
            if (!this._guildEliteIcon) 
            {
                this._guildEliteIcon = new BaseHintIcon(ImagesConst.copyHintIcon);
                this._guildEliteIcon.addEventListener(flash.events.MouseEvent.CLICK, this.onHintIconClick);
            }
            return this._guildEliteIcon;
        }

        public get guildEliteCopyInfoPanel(): GuildEliteCopyInfoPanel
        {
            if (!this._guildEliteCopyInfoPanel) 
            {
                this._guildEliteCopyInfoPanel = new GuildEliteCopyInfoPanel();
            }
            return this._guildEliteCopyInfoPanel;
        }

        public get guildEliteGroupModule(): GuildEliteGroupModule
        {
            if (!this._guildEliteGroupModule) 
            {
                this._guildEliteGroupModule = new GuildEliteGroupModule();
                this._guildEliteGroupModule.addEventListener(GModuleEvent.GuildGroup_FloorSelectedChange, this.onSelectedFloorChange);
            }
            return this._guildEliteGroupModule;
        }

        public get guildEliteGroupPanel(): GuildEliteGroupPanel
        {
            if (!this._guildEliteGroupPanel) 
            {
                this._guildEliteGroupPanel = new GuildEliteGroupPanel();
            }
            return this._guildEliteGroupPanel;
        }

        protected /* override */ initServer(): void
        {
            Dispatcher.addEventListener(EventName.GuildElite_ShowGuildEliteModule, this.doShowGuildEliteModule);
            Dispatcher.addEventListener(EventName.GuildElite_DoOpenGuildEliteCopy, this.doOpenGuildEliteCopy);
            Dispatcher.addEventListener(EventName.GuildElite_DoEnterGuildEliteCopy, this.doEnterGuildEliteCopy);
            Dispatcher.addEventListener(EventName.GuildElite_GetFloorPlayerNum, this.doGetFloorPlayerNum);
            Dispatcher.addEventListener(EventName.GuildElite_CopyInsidePass, this.doGuildEliteCopyInsidePass);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicGuildEliteCopyInfo, this.onReceiveGuildEliteCopyInfoHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicGuildEliteCopyDetail, this.onReceiveGuildEliteCopyDetailHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicGuildEliteCopyPlayerNum, this.onReceiveGuildEliteCopyPlayerNumHandler);
            NetDispatcher.addCmdListener(ServerCommand.GuildLeaveGuild, this.onLeaveGuild);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_ShowGroupModule, this.doShowEliteGroupModule);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_LeftGroup, this.doLeftGuildGroup);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_DisbandGroup, this.doDisbandGuildGroup);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_DoEnterGroup, this.doEnterGroup);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_DoKickOutTeam, this.doKickOutTeam);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_DoKickOutGroup, this.doKickOutGroup);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_DoModifyTeamLeader, this.doModifyTeamLeader);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_DoModifyCommander, this.doModifyCommander);
            Dispatcher.addEventListener(EventName.GuildEliteGroup_DoOpenGroup, this.doOpenGroup);
            NetDispatcher.addCmdListener(ServerCommand.GuildGroup_Create, this.onGuildGroupCreateHandler);
            NetDispatcher.addCmdListener(ServerCommand.GuildGroup_Disband, this.onGuildGroupDisbandHandler);
            NetDispatcher.addCmdListener(ServerCommand.GuildGroup_EntityUpdate, this.onGuildGroupEntityUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.GuildGroup_LeftGroup, this.onGuildGroupLeftHandler);
            NetDispatcher.addCmdListener(ServerCommand.GuildGroup_ModifyCommander, this.onGuildGroupModifyCommanderHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicGuildGroupKickOutFrom, this.onBeKickedOutBy);
            return;
        }

        /* internal  */doShowGuildEliteModule(arg1: DataEvent): void
        {
            var loc1=0;
            if (arg1.data != null) 
            {
                loc1 = arg1.data as int;
            }
            this.showGuildEliteModule(loc1);
            if (loc1 == 0) 
            {
                this.guildEliteModule.glowEffect();
            }
            return;
        }

        /* internal  */showGuildEliteModule(arg1: int=-1): void
        {
            this.guildEliteModule.show();
            if (arg1 >= 0) 
            {
                this.guildEliteModule.updateEnterSpDp();
                this.guildEliteModule.setSelectedFloor(arg1);
            }
            return;
        }

        /* internal  */doOpenGuildEliteCopy(arg1: DataEvent): void
        {
            if (cache.guild.isLeaderOrDeputyLeader) 
            {
                if (cache.guildElite.inPreTime) 
                {
                    this.onOpenCopyAlertHandler(Alert.OK);
                }
                else 
                {
                    Alert.show(Language.getString(60613), null, Alert.OK | Alert.CANCEL, null, this.onOpenCopyAlertHandler);
                }
            }
            else 
            {
                MsgManager.showRollTipsMsg(Language.getString(60409));
            }
            return;
        }

        /* internal  */onOpenCopyAlertHandler(arg1: int): void
        {
            if (arg1 == Alert.OK) 
            {
                GameProxy.copy.openGuildEliteCopy();
            }
            return;
        }

        /* internal  */doEnterGuildEliteCopy(arg1: DataEvent): void
        {
            var loc1=arg1.data as EliteTowerFloorData;
            if (loc1 && loc1.floor > 0) 
            {
                if (cache.copy.isInCopyType(ECopyType._ECopyGuildElite)) 
                {
                    MsgManager.showRollTipsMsg(Language.getString(60627));
                }
                else 
                {
                    GameProxy.copy.enterGuildElite(loc1.copyCode, 0);
                }
            }
            else 
            {
                MsgManager.showRollTipsMsg(Language.getString(60616));
            }
            return;
        }

        /* internal  */doGetFloorPlayerNum(arg1: DataEvent): void
        {
            var loc1=arg1.data as EliteTowerFloorData;
            if (!loc1) 
            {
                loc1 = cache.guildElite.getDataByFloor(cache.guildElite.maxFloor);
            }
            if (loc1) 
            {
                GameProxy.copy.getGuildEliteCopyPlayerNum(loc1.copyCode);
            }
            return;
        }

        /* internal  */doGuildEliteCopyInsidePass(arg1: DataEvent): void
        {
            var loc1=null;
            var loc2=null;
            if (copy) 
            {
                loc1 = arg1.data as SPassPoint;
                if (loc1 && loc1.passTo) 
                {
                    loc2 = loc1.passTo[0] as SPassTo;
                    if (loc2 && loc2.mapId == copy.intoMapId) 
                    {
                        GameProxy.sceneProxy.pass(EPassType.convert(EPassType._EPassTypeByPassPoint), loc1.passPointId, loc2.passToId);
                    }
                    else if (loc2) 
                    {
                        GameProxy.copy.enterGuildElite(copy.code, loc2.mapId);
                    }
                }
            }
            return;
        }

        /* internal  */onCopyTimeOut(): void
        {
            if (this._guildEliteIcon) 
            {
                this._guildEliteIcon.hide();
                this._guildEliteIcon.removeEventListener(flash.events.MouseEvent.CLICK, this.onHintIconClick);
                this._guildEliteIcon = null;
            }
            return;
        }

        /* internal  */onReceiveGuildEliteCopyInfoHandler(arg1: MessageBlock): void
        {
            var loc5=null;
            var loc1=arg1.messageBase as SGuildEliteCopyInfo;
            var loc2=cache.guildElite.guildEliteCopyInfo;
            cache.guildElite.guildEliteCopyInfo = loc1;
            var loc3=cache.guildElite.inTime;
            var loc4;
            if ((loc4 = cache.guildElite.inPreTime) && (loc2 == null && loc1.hasOpen == false || loc2 && !(loc2.preOpenDt.time == loc1.preOpenDt.time))) 
            {
                this.onGuildEliteCopyOpenHandler();
            }
            else if (loc3 && (loc2 == null && loc1.hasOpen == true || loc2 && loc2.hasOpen == false && loc1.hasOpen == true)) 
            {
                this.onGuildEliteCopyOpenHandler();
                MsgManager.showTaskTarget(Language.getString(60687));
                (loc5 = new Date()).setTime(loc1.openDt.time + 30 * 60 * 1000);
                ClockManager.instance.addDateCall(loc5, this.onCopyTimeOut);
            }
            else if (loc2 && loc2.hasOpen == true && loc1.hasOpen == false) 
            {
                this.onGuildEliteCopyCloseHandler();
            }
            else 
            {
                if (this._guildEliteModule && !this._guildEliteModule.isHide) 
                {
                    this._guildEliteModule.updateEnterSpDp();
                    this._guildEliteModule.setSelectedFloor(this._guildEliteModule.getSelectedFloor());
                }
                if (this._guildEliteCopyInfoPanel && !this._guildEliteCopyInfoPanel.isHide) 
                {
                    this._guildEliteCopyInfoPanel.updateInfos(cache.guildElite.copyDetail);
                }
                if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
                {
                    this._guildEliteGroupModule.updateData(this._guildEliteGroupModule.selectedFloor);
                }
            }
            if (GameMapUtil.curMapState.isGuildElite) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.MapUIUpdatePassPoint));
            }
            return;
        }

        /* internal  */onGuildEliteCopyOpenHandler(): void
        {
            this.guildEliteIcon.show();
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                this.updateGuildGroupButtonState();
            }
            else 
            {
                this.showGuildEliteModule(0);
                this.guildEliteModule.glowEffect();
                this.updateLeftTime();
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildHideOpenCopyWindow));
            return;
        }

        /* internal  */updateLeftTime(): void
        {
            var loc1=false;
            var loc2=false;
            var loc3=0;
            if (cache.guildElite.guildEliteCopyInfo) 
            {
                if (this._guildEliteModule && !this._guildEliteModule.isHide) 
                {
                    loc1 = cache.guildElite.inPreTime;
                    loc2 = cache.guildElite.inTime;
                    if (loc1) 
                    {
                        loc3 = (cache.guildElite.guildEliteCopyInfo.preOpenDt.time - ClockManager.instance.nowDate.time) / 1000;
                        this.guildEliteModule.updatePreLeftTime(loc3);
                    }
                    else if (loc2) 
                    {
                        loc3 = (cache.guildElite.guildEliteCopyInfo.openDt.time + 30 * 60 * 1000 - ClockManager.instance.nowDate.time) / 1000;
                        this.guildEliteModule.updateLeftTime(loc3);
                    }
                }
            }
            return;
        }

        /* internal  */onGuildEliteCopyCloseHandler(): void
        {
            if (this._guildEliteIcon) 
            {
                this._guildEliteIcon.hide();
                this._guildEliteIcon.removeEventListener(flash.events.MouseEvent.CLICK, this.onHintIconClick);
                this._guildEliteIcon = null;
            }
            if (this._guildEliteModule) 
            {
                this._guildEliteModule.hide();
                this._guildEliteModule.dispose();
                this._guildEliteModule = null;
            }
            cache.guildElite.resetGuildCopyInfo();
            return;
        }

        /* internal  */onReceiveGuildEliteCopyDetailHandler(arg1: MessageBlock): void
        {
            var loc1=arg1.messageBase as SGuildEliteCopyDetail;
            cache.guildElite.copyDetail = loc1;
            if (this._guildEliteCopyInfoPanel && !this._guildEliteCopyInfoPanel.isHide) 
            {
                this._guildEliteCopyInfoPanel.updateInfos(loc1);
            }
            return;
        }

        /* internal  */onReceiveGuildEliteCopyPlayerNumHandler(arg1: MessageBlock): void
        {
            var loc1=arg1.messageBase as SGuildEliteCopyDetail;
            cache.guildElite.updatePlayerNumDic(loc1);
            var loc2=CopyConfig.instance.getInfoByCode(loc1.copyCode);
            var loc3=loc2 ? loc2.maxPlayer : 0;
            if (this._guildEliteModule && !this._guildEliteModule.isHide) 
            {
                this._guildEliteModule.updatePlayerNum(loc1.playerNum, loc3);
                this._guildEliteModule.updateLeftTime(loc1.remainSeconds);
            }
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                this._guildEliteGroupModule.updatePlayerNum(loc1.playerNum, loc3);
                this._guildEliteGroupModule.updateLeftTime(loc1.remainSeconds);
            }
            return;
        }

        /* internal  */onLeaveGuild(arg1): void
        {
            this.onGuildEliteCopyCloseHandler();
            if (this._guildEliteGroupModule) 
            {
                this._guildEliteGroupModule.hide();
                this._guildEliteGroupModule.dispose();
                this._guildEliteGroupModule = null;
            }
            cache.guildElite.deleteAllGroup();
            return;
        }

        /* internal  */onHintIconClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=0;
            if (cache.copy.isInCopyType(ECopyType._ECopyGuildElite)) 
            {
                loc1 = GuildEliteConfig.instance.getFloorByCopycode(cache.copy.copyInfo.code);
            }
            this.showGuildEliteModule(loc1);
            if (loc1 == 0) 
            {
                this._guildEliteModule.glowEffect();
            }
            return;
        }

        /* internal  */onSceneUpdateHandler(arg1: DataEvent): void
        {
            return;
        }

        /* internal  */doShowEliteGroupModule(arg1: DataEvent): void
        {
            var loc1=null;
            var loc2=null;
            if (!cache.guildElite.inTime && !cache.guildElite.inPreTime) 
            {
                MsgManager.showRollTipsMsg(Language.getString(27917));
                return;
            }
            if (typeof arg1.data === "elitetowerfloordata") 
            {
                loc1 = arg1.data as EliteTowerFloorData;
                loc2 = cache.guildElite.getGuildGroup(loc1.copyCode);
            }
            else if (typeof arg1.data === "int") 
            {
                loc1 = cache.guildElite.getFloorDataByCopyCode(arg1.data as int);
                loc2 = cache.guildElite.getGuildGroup(arg1.data as int);
            }
            else 
            {
                if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
                {
                    this._guildEliteGroupModule.hide();
                    return;
                }
                if (copy) 
                {
                    loc1 = cache.guildElite.getFloorDataByCopyCode(copy.code);
                    loc2 = cache.guildElite.getGuildGroup(copy.code);
                }
                else 
                {
                    return;
                }
            }
            if (!loc1 || loc1.floor <= 0) 
            {
                MsgManager.showRollTipsMsg(Language.getString(60616));
                return;
            }
            if (loc1) 
            {
                this.guildEliteGroupModule.show();
                this.updateGuildGroupOpenedState();
                this.guildEliteGroupModule.selectedFloor = loc1;
                this.updateGuildGroupGroupPart(loc2);
                this.updateGuildGroupButtonState();
                GameProxy.copy.getGuildEliteCopyPlayerNum(loc1.copyCode);
            }
            return;
        }

        /* internal  */doLeftGuildGroup(arg1: DataEvent): void
        {
            var e: DataEvent;
            var data: EliteTowerFloorData;

            var loc1;
            e = arg1;
            data = e.data as EliteTowerFloorData;
            if (data && cache.guildElite.myGuildGroup && cache.guildElite.myGuildGroup.copyCode == data.copyCode) 
            {
                Alert.show(Language.getString(60677), null, Alert.OK | Alert.CANCEL, null, (arg1: int): void
                {
                    if (arg1 == Alert.OK) 
                    {
                        GameProxy.groupProxy.leftGuildGroup();
                    }
                    return;
                })
            }
            else 
            {
                MsgManager.showRollTipsMsg(Language.getString(60671));
            }
            return;
        }

        /* internal  */doDisbandGuildGroup(arg1: DataEvent): void
        {
            var e: DataEvent;
            var data: EliteTowerFloorData;

            var loc1;
            data = null;
            e = arg1;
            data = e.data as EliteTowerFloorData;
            if (data == null) 
            {
                return;
            }
            if (cache.guild.isLeaderOrDeputyLeader || cache.guildElite.isGuildGroupCommander(data.copyCode)) 
            {
                if (cache.guildElite.hasGuildGroup(data.copyCode)) 
                {
                    Alert.show(Language.getString(60681), null, Alert.OK | Alert.CANCEL, null, (arg1: int): void
                    {
                        var loc1=null;
                        if (arg1 == Alert.OK) 
                        {
                            loc1 = cache.guildElite.getGuildGroup(data.copyCode);
                            GameProxy.groupProxy.disbandGuildGroup(loc1.guildGroupId.id);
                        }
                        return;
                    })
                }
            }
            else 
            {
                MsgManager.showRollTipsMsg(Language.getString(60409));
            }
            return;
        }

        /* internal  */doEnterGroup(arg1: DataEvent): void
        {
            var loc1=arg1.data.group;
            var loc2=arg1.data.pos;
            if (copy && !(copy.code == loc1.copyCode)) 
            {
                MsgManager.showRollTipsMsg(Language.getString(60690));
                return;
            }
            GameProxy.groupProxy.applyGuildGroup(loc1.guildGroupId.id, loc2);
            return;
        }

        /* internal  */doKickOutTeam(arg1: DataEvent): void
        {
            var e: DataEvent;

            var loc1;
            e = arg1;
            Alert.show(Language.getString(60682), null, Alert.OK | Alert.CANCEL, null, (arg1: int): void
            {
                var loc1=null;
                var loc2=null;
                if (arg1 == Alert.OK) 
                {
                    loc1 = e.data.group;
                    loc2 = e.data.entityId;
                    GameProxy.groupProxy.kickOutGuildGroup(loc1.guildGroupId.id, loc2);
                }
                return;
            })
            return;
        }

        /* internal  */doKickOutGroup(arg1: DataEvent): void
        {
            var e: DataEvent;

            var loc1;
            e = arg1;
            Alert.show(Language.getStringByParam(60682, e.data.name), null, Alert.OK | Alert.CANCEL, null, (arg1: int): void
            {
                var loc1=null;
                var loc2=null;
                if (arg1 == Alert.OK) 
                {
                    loc1 = e.data.group;
                    loc2 = e.data.entityId;
                    GameProxy.groupProxy.kickOutGuildGroup(loc1.guildGroupId.id, loc2);
                }
                return;
            })
            return;
        }

        /* internal  */doModifyTeamLeader(arg1: DataEvent): void
        {
            var e: DataEvent;

            var loc1;
            e = arg1;
            Alert.show(Language.getStringByParam(60679, e.data.name), null, Alert.OK | Alert.CANCEL, null, (arg1: int): void
            {
                var loc1=null;
                var loc2=null;
                if (arg1 == Alert.OK) 
                {
                    loc1 = e.data.group;
                    loc2 = e.data.entityId;
                    GameProxy.groupProxy.modifyPostionGuildGroup(loc1.guildGroupId.id, loc2, EGuildGroupPos._EGuildGroupCaptain);
                }
                return;
            })
            return;
        }

        /* internal  */doModifyCommander(arg1: DataEvent): void
        {
            var e: DataEvent;

            var loc1;
            e = arg1;
            Alert.show(Language.getStringByParam(60680, e.data.name), null, Alert.OK | Alert.CANCEL, null, (arg1: int): void
            {
                var loc1=null;
                var loc2=null;
                if (arg1 == Alert.OK) 
                {
                    loc1 = e.data.group;
                    loc2 = e.data.entityId;
                    GameProxy.groupProxy.modifyPostionGuildGroup(loc1.guildGroupId.id, loc2, EGuildGroupPos._EGuildGroupCommander);
                }
                return;
            })
            return;
        }

        /* internal  */doOpenGroup(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            if (cache.guild.isLeaderOrDeputyLeader) 
            {
                GameProxy.groupProxy.createGuildGroup(loc1);
            }
            else 
            {
                MsgManager.showRollTipsMsg(Language.getString(60409));
            }
            return;
        }

        /* internal  */onGuildGroupCreateHandler(arg1: SGuildGroup): void
        {
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                this.updateGuildGroupOpenedState();
                if (this._guildEliteGroupModule.selectedCopy == arg1.copyCode) 
                {
                    this.updateGuildGroupGroupPart(arg1);
                }
            }
            return;
        }

        /* internal  */onGuildGroupLeftHandler(arg1: SGuildGroup): void
        {
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                if (this._guildEliteGroupModule.selectedCopy == arg1.copyCode) 
                {
                    this.updateGuildGroupGroupPart(arg1);
                }
            }
            this.updateCopyGroupPanelPlayers(arg1);
            return;
        }

        /* internal  */onGuildGroupModifyCommanderHandler(arg1: SGuildGroup): void
        {
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                if (this._guildEliteGroupModule.selectedCopy == arg1.copyCode) 
                {
                    this.updateGuildGroupGroupPart(arg1);
                }
            }
            return;
        }

        /* internal  */onBeKickedOutBy(arg1: MessageBlock): void
        {
            var loc1=arg1.messageBase as SAttribute;
            var loc2=loc1.value;
            var loc3=HTMLUtil.addColor(loc1.valueStr, GlobalStyle.color6);
            var loc4;
            var loc5=(loc4 = CopyConfig.instance.getInfoByCode(loc2)) ? loc4.name : "";
            Alert.show(Language.getStringByParam(60691, loc3, loc5), null, Alert.OK);
            return;
        }

        /* internal  */onGuildGroupEntityUpdateHandler(arg1: SGuildGroup): void
        {
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                if (this._guildEliteGroupModule.selectedCopy == arg1.copyCode) 
                {
                    this.updateGuildGroupGroupPart(arg1);
                }
            }
            this.updateCopyGroupPanelPlayers(arg1);
            return;
        }

        /* internal  */onGuildGroupDisbandHandler(arg1: SGuildGroup): void
        {
            if (arg1 == null) 
            {
                return;
            }
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                this.updateGuildGroupOpenedState();
                if (this._guildEliteGroupModule.selectedCopy == arg1.copyCode) 
                {
                    this.updateGuildGroupGroupPart(null);
                }
            }
            return;
        }

        /* internal  */onSelectedFloorChange(arg1: DataEvent): void
        {
            var loc1=null;
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                loc1 = cache.guildElite.getGuildGroup(this._guildEliteGroupModule.selectedCopy);
                this.updateGuildGroupGroupPart(loc1);
                GameProxy.copy.getGuildEliteCopyPlayerNum(this._guildEliteGroupModule.selectedCopy);
            }
            return;
        }

        /* internal  */updateGuildGroupOpenedState(): void
        {
            var loc2=null;
            var loc1=cache.guildElite.reachedFloors;
            var loc3=0;
            var loc4=loc1;
            for(loc2 of loc4) 
            {
                loc2.opened = cache.guildElite.hasGuildGroup(loc2.copyCode);
            }
            if (this._guildEliteGroupModule && !this._guildEliteGroupModule.isHide) 
            {
                this._guildEliteGroupModule.updateTabData(loc1);
            }
            return;
        }

        /* internal */ /* var */_guildEliteModule: GuildEliteModule;

        /* internal */ /* var */_guildEliteIcon: BaseHintIcon;

        /* internal */ /* var */_guildEliteCopyInfoPanel: GuildEliteCopyInfoPanel;

        /* internal */ /* var */_guildEliteGroupModule: GuildEliteGroupModule;

        /* internal */ /* var */_guildEliteGroupPanel: GuildEliteGroupPanel;
    }
